FROM centos:7

MAINTAINER hbsky "hbsky2015@aliyun.com"

#设置系统编码
RUN yum install kde-l10n-Chinese -y
RUN yum install glibc-common -y
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
#RUN export LANG=zh_CN.UTF-8
#RUN echo "export LANG=zh_CN.UTF-8" >> /etc/locale.conf
#ENV LANG zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8
#时区
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone

#创建默认文件夹
RUN mkdir -p /home/yuqing/fastdfs

#所需全部工具运行命令
RUN yum -y install zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools wget gd gd-devel
RUN yum install lrzsz -y

#install libfastcommon
#ADD libfastcommon-1.0.7.zip /usr/local/src/
ADD libfastcommon-1.0.35.zip /usr/local/src/
RUN cd /usr/local/src \
    && unzip /usr/local/src/libfastcommon-1.0.35.zip \
    && cd libfastcommon-1.0.35 \
    && ./make.sh \
    && ./make.sh install

#install fastdfs
ADD fastdfs-5.11.zip /usr/local/src/
RUN cd /usr/local/src/ && unzip fastdfs-5.11.zip
RUN cd /usr/local/src/fastdfs-5.11 \
&& ./make.sh \
&& ./make.sh install \
&& cp conf/*.conf /etc/fdfs \
&& cd /etc/fdfs/ \
&& rm -rf *.sample

#install nginx
ADD fastdfs-nginx-module_v1.16.tar.gz /usr/local/src/
#run cd /usr/local/src/ && unzip fastdfs-nginx-module-1.20.zip && ln -s fastdfs-nginx-module-1.20 fastdfs-nginx-module
ADD nginx-1.7.8.tar.gz /usr/local/src/
RUN cd /usr/local/src/ \
    && cd nginx-1.7.8 \
    && ./configure --prefix=/usr/local/nginx --with-http_image_filter_module --add-module=/usr/local/src/fastdfs-nginx-module/src \
    && make \
    && make install \
    && cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
ADD nginx.conf /usr/local/nginx/conf/

#启动文件
ADD tracker.sh /
ADD storage.sh /
